The analysis depends on the following variables defined in
configure.R
| Variable | Value |
|---|---|
| Experimental conditions | rbohF - WT (CTRL), rbohC - WT (CTRL), rbohF - rbohC (CTRL), rbohC (Cd - CTRL), rbohF (Cd - CTRL), WT (Cd - CTRL) |
| Data file(s) | data/rbohF_C_vs_WT_C_filt.tsv, data/rbohC_C_vs_WT_C_filt.tsv, data/rbohF_C_vs_rbohC_C_filt.tsv, data/rbohC_C_vs_Cd.tsv, data/rbohF_C_vs_Cd.tsv, data/WT_C_vs_Cd.tsv |
| Total proteins file | data/identification_all_samples_proteins.tsv |
| Subcellular location file with annotations | location/proteins_locations_modified.tsv |
| Subcellular location ontology | location/subcel_location_unique.txt |
Read proteomic results of DEPs for different analyses.
# DEP counts ####
counts <- list()
for (i in 1:length(FILE)) {
counts[[FILE_NAME[i]]] <- read.table(file = FILE[i],
sep = "\t",
header = TRUE,
row.names = 1,
check.names = FALSE,
quote = "",
comment.char = "") # turn off the interpretation of comments
}
# subcellular location file ####
location <- read.delim(file = LOCATION,
sep = "\t",
header = TRUE,
row.names = 1)
# subcellular location ontology ####
location_cat <- scan(file = LOCATION_CAT,
what = character(),
sep = "\n")
Let’s create the function get_venn() for plotting the
desired Venn diagrams.
# function to extract the DEPs from the experimental situations that will be represented by Venn diagrams, plots the diagram, and saves the lists in the intersections
get_venn <- function(proteins_input, vector, counts, venn_table) {
proteins <- list()
# DEPs including up- and down-regulated (all DEPs)
proteins[["all"]] <- list()
# get absolute values for vector
for (i in abs(vector)){
proteins$all[[names(counts[i])]] <- rownames(counts[[i]])
}
# up- and down- DEPs split
proteins[["up"]] <- list()
proteins[["down"]] <- list()
for (i in abs(vector)) {
# get sign from i
sign <- sign(vector[which(abs(vector) == i)])
# get Abundance Ratio column
tmp <- counts[[i]][, grep("Abundance Ratio \\(log2\\)", colnames(counts[[i]])), drop = FALSE]
# if vector [i] <0, we need to change positives and negatives
if (sign > 0) {
# Filter > 0
tmp_up <- tmp[tmp[1] > 0, , drop = FALSE]
# Filter < 0
tmp_down <- tmp[tmp[1] < 0, , drop = FALSE]
} else {
# Filter > 0
tmp_up <- tmp[tmp[1] < 0, , drop = FALSE]
# Filter < 0
tmp_down <- tmp[tmp[1] > 0, , drop = FALSE]
}
# Add to the lists
proteins$up[[names(counts[i])]] <- rownames(tmp_up)
proteins$down[[names(counts[i])]] <- rownames(tmp_down)
}
# venn diagrams for all-DEPs, up and down ####
venn_intersections <- list() # para guardar las intersecciones para tabla de discordancias
venn_data <- data.frame()
for (i in 1:length(proteins)) {
## Venn #####
venn_plot <- venn(proteins[[i]],
ilabels = "counts",
zcolor = "style",
box = FALSE)
title(paste0(names(proteins[i]), "-DEPs"), # toma el nombre del id de la lista
line = -1) # para que no se pegue a la imagen
if (length(venn_data) == 0) { # Añadir el primer elemento
if (length(proteins[[i]]) == 2) {
venn_data <- venn_plot[2:4, 3, drop = FALSE] # get counts of each comparison
} else {
venn_data <- venn_plot[2:8, 4, drop = FALSE] # get counts of each comparison
}
venn_data$intersections <- rownames(venn_data) # add column intersection with rownames
venn_data <- venn_data[, c(2,1)] # reorder
colnames(venn_data)[i+1] <- names(proteins[i]) # remame counts column
} else { # merge los demás elementos por ID de prot
if (length(proteins[[i]]) == 2) {
tmp_venn <- venn_plot[2:4, 3, drop = FALSE] # get counts of each comparison
} else {
tmp_venn <- venn_plot[2:8, 4, drop = FALSE] # get counts of each comparison
}
tmp_venn$intersections <- rownames(tmp_venn)
tmp_venn <- tmp_venn[, c(2,1)]
colnames(tmp_venn)[2] <- names(proteins[i])
venn_data <- merge(venn_data, tmp_venn, by = 1, sort = FALSE)
} # end else if length(venn_data) == 0
intersections <- calculate.overlap(proteins[[i]]) # calculate.overlap fails when there is only 2 lists to compare. You can use get.venn.partitions()
# adjust intersections if only 2 lists
if (length(proteins[[i]]) == 2) {
intersections$a1 <- setdiff(intersections$a1, intersections$a3)
intersections$a2 <- setdiff(intersections$a2, intersections$a3)
}
## define names for the intersections ####
if (length(proteins[[i]]) == 2) {
a1 <- paste0(names(proteins[[i]][1]))
a2 <- paste0(names(proteins[[i]][2]))
a3 <- paste0("(", a1, ")", "-", "(", a2, ")")
names(intersections) <- c(a1, a2, a3) # give the new names to intersections
} else {
a123 <- paste0(names(proteins[[i]][1]),
"-",
names(proteins[[i]][2]),
"-",
names(proteins[[i]][3]))
a12 <- paste0(names(proteins[[i]][1]),
"-",
names(proteins[[i]][2]))
a13 <- paste0(names(proteins[[i]][1]),
"-",
names(proteins[[i]][3]))
a23 <- paste0(names(proteins[[i]][2]),
"-",
names(proteins[[i]][3]))
a1 <- paste0(names(proteins[[i]][1]))
a2 <- paste0(names(proteins[[i]][2]))
a3 <- paste0(names(proteins[[i]][3]))
names(intersections) <- c(a123, a12, a13, a23, a1, a2, a3) # give the new names to intersections
}
# asingar los solapamientos entre fenotipos al elemento de la lista all, up o down
venn_intersections[[names(proteins[i])]] <- intersections
}
# assign name to the variable
assign(proteins_input, proteins, envir = .GlobalEnv)
assign(venn_table, venn_intersections, envir = .GlobalEnv)
}
For each mutant, we will compare the differentially expressed proteins (DEPs) that change after Cd treatment (Cd vs CTRL) and that change in respect to the WT.
DEPs will be treated all together and also separating by up- and down-regulation.
Guide in interpret the results for mutants:
Diagrams comparing DEPs in rbohF
mutant when compared to WT (rbohF - WT (CTRL)) and under Cd
treatment (rbohF (Cd- CTRL)).
# vector that corresponds to the elements of counts to use
vector <- c(5, 1)
get_venn("proteins_rbohF", vector, counts, "venn_intersections_rbohF")
See genes in each intersection at Table with DEP intersections.
Diagrams comparing DEPs in rbohC
mutant when compared to WT (rbohC - WT (CTRL)) and under Cd
treatment (rbohC (Cd- CTRL)).
# vector that corresponds to the elements of counts to use
vector <- c(4, 2)
get_venn("proteins_rbohC", vector, counts, "venn_intersections_rbohC")
See genes in each intersection at Table with DEP intersections.
# get proteins IDs from the comparisons we've used
proteins_list <- unique(unlist(lapply(counts[c(1, 2, 4, 5)], rownames)))
# create empty dataframe
table <- data.frame(matrix(ncol = 6, nrow = length(proteins_list)))
# assign colnames
colnames(table) <- c("rbohF (Cd - CTRL)",
"rbohF_both",
"rbohF - WT (CTRL)",
"rbohC (Cd - CTRL)",
"rbohC_both",
"rbohC - WT (CTRL)")
# assign rownames
rownames(table) <- proteins_list
# assign +1 or -1 per comparison rbohC
table$`rbohC (Cd - CTRL)` <- ifelse(rownames(table) %in% venn_intersections_rbohC$up$`rbohC (Cd - CTRL)`,
"+1",
ifelse(rownames(table) %in% venn_intersections_rbohC$down$`rbohC (Cd - CTRL)`,
"-1",
NA))
table$`rbohC - WT (CTRL)` <- ifelse(rownames(table) %in% venn_intersections_rbohC$up$`rbohC - WT (CTRL)`,
"+1",
ifelse(rownames(table) %in% venn_intersections_rbohC$down$`rbohC - WT (CTRL)`,
"-1",
NA))
table$rbohC_both <- ifelse(rownames(table) %in% venn_intersections_rbohC$up$`(rbohC (Cd - CTRL))-(rbohC - WT (CTRL))`,
"+1",
ifelse(rownames(table) %in% venn_intersections_rbohC$down$`(rbohC (Cd - CTRL))-(rbohC - WT (CTRL))`,
"-1",
NA))
# assign +1 or -1 per comparison rbohF
table$`rbohF (Cd - CTRL)` <- ifelse(rownames(table) %in% venn_intersections_rbohF$up$`rbohF (Cd - CTRL)`,
"+1",
ifelse(rownames(table) %in% venn_intersections_rbohF$down$`rbohF (Cd - CTRL)`,
"-1",
NA))
table$`rbohF - WT (CTRL)` <- ifelse(rownames(table) %in% venn_intersections_rbohF$up$`rbohF - WT (CTRL)`,
"+1",
ifelse(rownames(table) %in% venn_intersections_rbohF$down$`rbohF - WT (CTRL)`,
"-1",
NA))
table$rbohF_both <- ifelse(rownames(table) %in% venn_intersections_rbohF$up$`(rbohF (Cd - CTRL))-(rbohF - WT (CTRL))`,
"+1",
ifelse(rownames(table) %in% venn_intersections_rbohF$down$`(rbohF (Cd - CTRL))-(rbohF - WT (CTRL))`,
"-1",
NA))
datatable(table,
options = list(pageLength = 10), # number of lines by default
caption = "Summary table of the DEPs in the Venn comparisons. +1 is up-regulated, -1 for down-regulated.")
This analysis is complementary to the previous one, but now we will detect DEPs that are common in both mutants.
# vector that corresponds to the elements of counts to use
vector <- c(5, 3, 1)
get_venn("proteins_rbohF-rbohC", vector, counts, "venn_intersections_rbohF-rbohC")
# vector that corresponds to the elements of counts to use
vector <- c(4, -3, 2)
get_venn("proteins_rbohC-rbohF", vector, counts, "venn_intersections_rbohC-rbohF")
NOTE: To have up-regutation for rbohC when the comparison is rbohF - rbohC (CTRL), the sign of fold changes value in the vector has been inverted.
We will save files containing DEPs in each intersection.
Saving intersections for rbohF:
filenames <- "" # empty variable for filenames
# rbohF
for (i in 1:length(`venn_intersections_rbohF-rbohC`)) {
## modify intersection results ready to save
tmp <- `venn_intersections_rbohF-rbohC`[[i]]
# extract the lists of interest (those that are not in the previous Venn)
tmp <- tmp[c(1, 3, 4, 7)]
tmp <- do.call(rbind, lapply(tmp, data.frame)) # convert list in table
tmp$intersections <- rownames(tmp) # add a column with the comparisons
colnames(tmp)[1] <- "protein" # change column name to 'protein'
tmp$intersections <- gsub("\\..*", "", tmp$intersections) # remove the .Number
tmp <- tmp[,c(2,1)] # change column order
file_name <- paste0(SUB_DIR,
"DEP_rbohF-rbohC_",
names(`venn_intersections_rbohF-rbohC`[i]),
".tsv")
write.table(tmp, # save the table
file = file_name,
quote = FALSE,
sep = "\t",
row.names = FALSE,
col.names = TRUE)
filenames <- c(filenames, paste0("**", names(`venn_intersections_rbohF-rbohC`[i]), "** : ", file_name, "\n"))
}
message("Files with DEPs intersections were saved in \n", filenames)
Note:
Files with DEPs intersections were saved in
all : /home/bullones/Dropbox/Proteomica_arabidopsis/supplementary/results_2026-01-20_15.57.05/DEP_rbohF-rbohC_all.tsv
up : /home/bullones/Dropbox/Proteomica_arabidopsis/supplementary/results_2026-01-20_15.57.05/DEP_rbohF-rbohC_up.tsv
down : /home/bullones/Dropbox/Proteomica_arabidopsis/supplementary/results_2026-01-20_15.57.05/DEP_rbohF-rbohC_down.tsv
Saving intersections for rbohC:
filenames <- "" # empty variable for filenames
# rbohC
for (i in 1:length(`venn_intersections_rbohC-rbohF`)) {
## modify intersection results ready to save
tmp <- `venn_intersections_rbohC-rbohF`[[i]]
# extract the lists of interest (those that are not in the previous Venn)
tmp <- tmp[c(1, 3, 4, 7)]
tmp <- do.call(rbind, lapply(tmp, data.frame)) # convert list in table
tmp$intersections <- rownames(tmp) # add a column with the comparisons
colnames(tmp)[1] <- "protein" # change column name to 'protein'
tmp$intersections <- gsub("\\..*", "", tmp$intersections) # remove the .Number
tmp <- tmp[,c(2,1)] # change column order
file_name <- paste0(SUB_DIR,
"DEP_rbohC-rbohF_",
names(`venn_intersections_rbohC-rbohF`[i]),
".tsv")
write.table(tmp, # save the table
file = file_name,
quote = FALSE,
sep = "\t",
row.names = FALSE,
col.names = TRUE)
filenames <- c(filenames, paste0("**", names(`venn_intersections_rbohC-rbohF`[i]), "** : ", file_name, "\n"))
}
message("Files with DEPs intersections were saved in \n", filenames)
Note:
Files with DEPs intersections were saved in
all : /home/bullones/Dropbox/Proteomica_arabidopsis/supplementary/results_2026-01-20_15.57.05/DEP_rbohC-rbohF_all.tsv
up : /home/bullones/Dropbox/Proteomica_arabidopsis/supplementary/results_2026-01-20_15.57.05/DEP_rbohC-rbohF_up.tsv
down : /home/bullones/Dropbox/Proteomica_arabidopsis/supplementary/results_2026-01-20_15.57.05/DEP_rbohC-rbohF_down.tsv
We will select DEPs in the intersection defined in Venn diagrams of Mutant vs WT.
Then for those DEPs, we will plot the
log2(abundance ratio) for the experimental conditions
represented in Mutant vs WT and the other
mutant.
Remember from the mentioned sections that:
- From the 33 DEPs in all-DEPs in rbohC, 14 are also in rbohF; and from the 53 DEPs in all-DEPs in rbohF, 36 are also in rbohC.
- But only a few DEPs in the rbohC mutant change their expression as in rbohF mutant: 1 in up and the 2 DEPs in down.
- From the rbohF plots, it seems that nothing is common with rbohC.
Here it is defined function plot_heatmap() to obtain the
heatmaps for the DEPs in the intersections.
plot_heatmap <- function(venn_intersections, vector, counts) {
# extract DEPs IDs
deps_ids <- unlist(venn_intersections$all[3],
use.names = FALSE)
# prepare data for heatmap
heatmap <- list()
for (i in abs(vector)) {
# get sign from i
sign <- sign(vector[which(abs(vector) == i)])
# get Abundance Ratio column
tmp <- counts[[i]][deps_ids,
grep("Abundance Ratio \\(log2\\)",
colnames(counts[[i]])),
drop = FALSE]
# if vector[i] < 0, we need to change positives and negatives
if (sign < 0) {
tmp <- tmp * -1
}
# remove NA values from proteins that are not in the two mutants comparison
tmp <- na.omit(tmp)
tmp$proteins <- rownames(tmp)
tmp <- tmp[, c(2, 1)]
colnames(tmp)[2] <- "log2"
heatmap[[names(counts[i])]] <- tmp
}
# convert the list into a long dataframe
heatmap <- do.call(rbind, heatmap)
heatmap$condition <- rownames(heatmap)
heatmap$condition <- gsub("\\..*", "", heatmap$condition)
# create short dataframe for pheatmap
mat <- acast(heatmap, proteins ~ condition, value.var = "log2")
# order columns
order <- names(counts[abs(vector)])
mat <- mat[, order]
# define colors
colors <- colorRampPalette(c("#F8766D", "white", "#00BFC4"))(100)
# represent pheatmap
pheatmap(mat,
color = colors,
breaks = NA,
na_col = "white",
cluster_rows = TRUE,
cluster_cols = FALSE,
legend = TRUE,
border_color = NA,
cellwidth = 10,
cellheight = 10,
fontsize = 8,
angle_col = "315")
}
We will analyse the expression of the DEPs in the intersection of all-DEPs Venn Diagram.
# vector that corresponds to the elements of counts to use
vector <- c(5, 1, 3)
plot_heatmap(venn_intersections_rbohF, vector, counts)
Note that a white color indicates that the protein was not DEP for this condition.
We will analyse the expression of the DEPs in the intersection of all-DEPs Venn Diagram.
# vector that corresponds to the elements of counts to use
vector <- c(4, 2, -3)
plot_heatmap(venn_intersections_rbohC, vector, counts)
Note that a white color indicates that the protein was not DEP for this condition.
NOTE: In this heatmap, as occurred in Venn diagrams, to have up-regutation in rbohC when the comparison is rbohF - rbohC (CTRL), we have inverted the sign of fold changes value in the vector.
Let’s build a contingency table to know how many DEPs are located in a membrane. During calculations, a message will be printed to indicate if there are transmembrane proteins that are not from \(\alpha\)-helical type.
# define vector with the comparisons to use
vector <- c(1:3)
# create dataframe to save transmembrane info
transmembrane <- data.frame(matrix(ncol = 4, nrow = 0))
colnames(transmembrane) <- c("condition", "total", "trans", "perc")
for (i in vector) {
# merge proteins with location info
tmp <- merge(x = counts[[i]],
y = location,
by = "row.names",
all = FALSE,
sort = FALSE)
# get rownames (protein IDs) and transmembrane info
tmp <- tmp[c("Row.names", "Transmembrane")]
# save total proteins number
total_prot <- length(rownames(tmp))
# keep transmembrane proteins
keep <- grep("TRANSMEM", tmp$Transmembrane, ignore.case = TRUE)
tmp <- tmp[keep, ]
# save transmembrane proteins number
transmembrane_prot <- length(rownames(tmp))
# calculate transmembrane proteins percentage
transmembrane_perc <- round((transmembrane_prot/total_prot)*100,
digits = 0)
# add info to transmembrane dataframe
transmembrane[nrow(transmembrane) +1,] <- c(names(counts[i]),
total_prot,
transmembrane_prot,
transmembrane_perc)
# save helical proteins number
helical <- length(grep("Helical", tmp$Transmembrane, ignore.case = TRUE))
# check if all transmembrane proteins are helical type
if (helical != transmembrane_prot) {
message(paste0("For ",
names(counts[i]),
" not all transmembrane proteins are helical type."))
} else {
message(paste0("For ",
names(counts[i]),
" **all** transmembrane proteins are helical type."))
}
}
Note:
For rbohF - WT (CTRL) all transmembrane proteins are helical type.
Note:
For rbohC - WT (CTRL) not all transmembrane proteins are helical type.
Note:
For rbohF - rbohC (CTRL) not all transmembrane proteins are helical type.
# print summary table
kable(transmembrane,
col.names = c("Condition",
"Total",
"Transmemb.",
"Percent. (%)"),
align = "lcccc")
| Condition | Total | Transmemb. | Percent. (%) |
|---|---|---|---|
| rbohF - WT (CTRL) | 464 | 117 | 25 |
| rbohC - WT (CTRL) | 453 | 103 | 23 |
| rbohF - rbohC (CTRL) | 351 | 77 | 22 |
rm(tmp, total_prot, transmembrane_prot, transmembrane_perc, helical, transmembrane)
We check the location of the membrane DEPs of the comparisons made with the Venn diagrams.
First, we will define the function location_membrane()
to plot the results.
location_membrane <- function(venn_intersections, location, location_cat) {
# create a list to save membrane protein location
membrane_proteins_location <- list()
# assign location to the Venn diagram proteins
for (i in 1:length(venn_intersections)) {
# create sublist
membrane_proteins_location[[names(venn_intersections[i])]] <- list()
for (j in 1:length(venn_intersections[[i]])) {
# extract venn_intersections[[i]][[j]] protein IDs
tmp <- venn_intersections[[i]][[j]]
# merge the protein IDs with their subcellular location
tmp <- merge(x = tmp,
y = location,
by.x = 1,
by.y = "row.names",
all = FALSE,
sort = FALSE)
# keep x (protein IDs) and subcellular location info
tmp <- tmp[c("x", "Subcellular.location")]
colnames(tmp)[1] <- "Protein.ID"
# keep only membrane proteins
tmp <- tmp[grep("membrane",
tmp$Subcellular.location,
ignore.case = TRUE),]
# check if tmp is empty
if(nrow(tmp) != 0) {
name <- names(venn_intersections[[i]][j])
# save info in membrane_proteins_location sublist
membrane_proteins_location[[names(venn_intersections[i])]][[name]] <- tmp
} # end if
} # end for j
} # end for i
# split those proteins according to their location
location_membrane <- location_cat[grep("membrane",
location_cat,
ignore.case = TRUE)]
# create a list to save subcellular membrane proteins
subcell_membrane_proteins <- list()
# subcell_save <- list()
for (i in 1:length(membrane_proteins_location)) {
name <- names(membrane_proteins_location[i])
# create sublist for membrane_proteins_location[i]
subcell_membrane_proteins[[name]] <- data.frame(matrix(ncol = 3, nrow = 0))
colnames(subcell_membrane_proteins[[name]]) <- c("location", "count", "intersections")
# subcell_save[[name]] <- data.frame(matrix(ncol = 3, nrow = 0))
# colnames(subcell_save[[name]]) <- c("protein", "intersections", "location")
# get membrane proteins location for iteration i
tmp <- membrane_proteins_location[[i]]
# convert it into a dataframe
tmp <- do.call(rbind, tmp)
tmp$intersections <- rownames(tmp)
tmp$intersections <- gsub("\\..*", "", tmp$intersections)
# check each location membrane
for (j in 1:length(location_membrane)) {
keep <- grep(location_membrane[j],
tmp$Subcellular.location,
ignore.case = TRUE)
# check if keep is empty
if (length(keep) != 0) {
# keep proteins with location membrane [j]
tmp2 <- tmp[keep,]
# get unique intersection
tmp2_intersections <- tmp2$intersections
tmp2_intersections <- unique(tmp2_intersections)
# check each intersection
for (k in 1:length(tmp2_intersections)) {
# get proteins in intersection k
tmp3 <- tmp2[tmp2$intersections == tmp2_intersections[k],]
# add it to subcell_membrane_proteins list
subcell_membrane_proteins[[i]][nrow(subcell_membrane_proteins[[i]]) +1,] <- c(location_membrane[j], length(rownames(tmp3)), tmp2_intersections[k])
# tmp3$location_membrane <- location_membrane[j]
# tmp3 <- tmp3[,-2]
# subcell_save[[i]] <- rbind(subcell_save[[i]], tmp3)
# subcell_save[[i]][[tmp2_intersections[k]]] <- tmp3
} # end for k
} # end if
} # end for j
} # end for i
# for no membrane general location
subcell_membrane_no_proteins <- list()
for (i in 1:length(subcell_membrane_proteins)) {
# get subcellular membrane proteins for iteration i
tmp <- subcell_membrane_proteins[[i]]
# remove the membrane specific
tmp <- tmp[-grep("^membrane$", tmp$location, ignore.case = TRUE),]
name <- names(subcell_membrane_proteins[i])
# save in subcell_membrane_no_proteins list
subcell_membrane_no_proteins[[name]] <- tmp
}
# with membrane general term
# create list
data_barplot <- list()
# create object for interactive plot
plt <- htmltools::tagList()
for (i in 1:length(subcell_membrane_proteins)) {
# create sublist
data_barplot[[names(subcell_membrane_proteins[i])]] <- list()
# get subcellular membrane proteins for iteration i
tmp <- subcell_membrane_proteins[[i]]
# get unique intersections
tmp_intersections <- unique(tmp$intersections)
# create empty list
l <- list()
for (j in 1:length(tmp_intersections)) {
# get location info for intersection i
l[[tmp_intersections[j]]] <- tmp[tmp$intersections == tmp_intersections[j],
c(1, 2)]
} # end for j
# create empty dataframe
df <- data.frame()
for (k in 1:length(l)) {
# get location for iteration k
tmp2 <- l[[k]]
# change colnames
colnames(tmp2)[2] <- tmp_intersections[k]
# add info to df depending on the iteration
if (k == 1){
df <- tmp2
} else {
df <- merge(x = df,
y = tmp2,
by = 1,
all = TRUE,
sort = FALSE)
} # end else
} # end for k
# substitute NA for 0
df[is.na(df)] <- 0
# convert into a long dataframe
mm <- melt(df, id.vars = "location")
mm$value <- as.numeric(mm$value)
# ggplot
gg_barplot<- ggplot(mm, aes(x = location, y = value)) +
geom_bar(stat = "identity") + # can add width = 0.2 to change it
facet_grid(.~variable) +
coord_flip() +
ggtitle(paste0(names(subcell_membrane_proteins[i]), " proteins")) +
theme(panel.grid.major = element_blank(), # remove major grid
panel.grid.minor = element_blank(), # remove minor grid
panel.background = element_blank()) + # remove background
theme(text = element_text(size = 8))
# add ggplot to plotly object
plt[[i]] <- as_widget(ggplotly(gg_barplot))
} # end for i
# return object
return(plt)
}
Elapsed time: 0.04 min.
## Variables in memory:
## [1] "counts" "FILE"
## [3] "file_name" "FILE_NAME"
## [5] "FILE_TOTAL" "filenames"
## [7] "get_venn" "HOY"
## [9] "i" "keep"
## [11] "location" "LOCATION"
## [13] "location_cat" "LOCATION_CAT"
## [15] "location_membrane" "MY_TITLE"
## [17] "plot_heatmap" "proteins_list"
## [19] "proteins_rbohC" "proteins_rbohC-rbohF"
## [21] "proteins_rbohF" "proteins_rbohF-rbohC"
## [23] "SOURCE_DIR" "SUB_DIR"
## [25] "T_total" "T00"
## [27] "table" "vector"
## [29] "venn_intersections_rbohC" "venn_intersections_rbohC-rbohF"
## [31] "venn_intersections_rbohF" "venn_intersections_rbohF-rbohC"
## [33] "VERBOSE_MODE" "WD_DIR"
##
## R version 4.5.2 (2025-10-31)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.3 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8
## [5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=es_ES.UTF-8
## [7] LC_PAPER=es_ES.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Europe/Madrid
## tzcode source: system (glibc)
##
## attached base packages:
## [1] grid stats graphics grDevices utils datasets
## [7] methods base
##
## other attached packages:
## [1] RColorBrewer_1.1-3 pheatmap_1.0.13 DT_0.34.0
## [4] reshape2_1.4.5 data.table_1.17.8 dplyr_1.1.4
## [7] plotly_4.11.0 VennDiagram_1.7.3 futile.logger_1.4.3
## [10] ggplot2_4.0.1 venn_1.12 rmarkdown_2.30
## [13] knitr_1.50
##
## loaded via a namespace (and not attached):
## [1] sass_0.4.10 generics_0.1.4 tidyr_1.3.1
## [4] futile.options_1.0.1 stringi_1.8.7 digest_0.6.38
## [7] magrittr_2.0.4 evaluate_1.0.5 fastmap_1.2.0
## [10] plyr_1.8.9 jsonlite_2.0.0 formatR_1.14
## [13] httr_1.4.7 purrr_1.2.0 crosstalk_1.2.2
## [16] viridisLite_0.4.2 scales_1.4.0 lazyeval_0.2.2
## [19] jquerylib_0.1.4 cli_3.6.5 rlang_1.1.6
## [22] cachem_1.1.0 withr_3.0.2 yaml_2.3.10
## [25] tools_4.5.2 lambda.r_1.2.4 vctrs_0.6.5
## [28] R6_2.6.1 lifecycle_1.0.4 stringr_1.6.0
## [31] htmlwidgets_1.6.4 admisc_0.39 pkgconfig_2.0.3
## [34] pillar_1.11.1 bslib_0.9.0 gtable_0.3.6
## [37] rsconnect_1.6.1 glue_1.8.0 Rcpp_1.1.0
## [40] xfun_0.54 tibble_3.3.0 tidyselect_1.2.1
## [43] rstudioapi_0.17.1 dichromat_2.0-0.1 farver_2.1.2
## [46] htmltools_0.5.8.1 labeling_0.4.3 compiler_4.5.2
## [49] S7_0.2.1